//
//  DDQuestionAnswerSetElementBodyViewController.m
//  dingdang
//
//  Created by Chen Jing on 15-7-11.
//  Copyright (c) 2015年 阮 沧晖. All rights reserved.
//

#import "DDQuestionAnswerSetElementBodyViewController.h"
#import "PlaceholderTextView.h"

@interface DDQuestionAnswerSetElementBodyViewController ()
@property (weak, nonatomic) IBOutlet UIView *contentOfMain;
@property (weak, nonatomic) IBOutlet PlaceholderTextView *textView_edit;

@end

@implementation DDQuestionAnswerSetElementBodyViewController

- (void)viewDidLoad {
    NSLog(@"进入到---------->DDQuestionAnswerSetElementBodyViewController");
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
    [self createUI];

}

-(void)viewWillAppear:(BOOL)animated{
    [super viewWillAppear:animated];
    [self.textView_edit becomeFirstResponder];
}

-(void)createUI{
    self.automaticallyAdjustsScrollViewInsets = NO;
    [self addNavigatorTitle:NSLocalizedString(@"选项内容", nil) parent:self.view];
    self.barViewControl.view.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"top_Background"]];

    [self AddLeftBtnAction:@"" normal:@"top_返回" selected:@"top_返回" action:^{
        [self.navigationController popViewControllerAnimated:YES];
    }];

    [self AddRightBtnAction:@"完成" normal:@"" selected:@"" action:^{
        if (self.delegate && [self.delegate respondsToSelector:@selector(DDQuestionAnswerSetElementBodyViewControllerEditFinish:)]) {
            NSString * tempString = nil;
            if (self.textView_edit.text == nil) {
                tempString = @"";
            }else{
                tempString = self.textView_edit.text;
            }

            [self.delegate performSelector:@selector(DDQuestionAnswerSetElementBodyViewControllerEditFinish:) withObject:tempString];

        }
        [self.navigationController popViewControllerAnimated:YES];
    }];

    self.textView_edit.layer.cornerRadius = 10;
    self.textView_edit.layer.borderColor = [UIColor lightGrayColor].CGColor;
    self.textView_edit.layer.borderWidth = .5;
    self.textView_edit.layer.masksToBounds = YES;
    self.textView_edit.placeholder = @"请输入解析内容";
    self.textView_edit.placeholderColor = [UIColor lightGrayColor];
    self.textView_edit.placeholderFont = self.textView_edit.font;
    
    if (self.info_oldString) {
        self.textView_edit.text = self.info_oldString;
    }
}



- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
